home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Utilities / Random / Commodore 64c / SOURCE / Error.c < prev    next >
Text File  |  1994-03-19  |  2KB  |  57 lines

  1. /*
  2.     Commodore 64 Emulator v0.2      Earle F. Philhower III 
  3.     Copyright (C) 1993-4            (st916w9r@dunx1.ocs.drexel.edu)
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 2 of the License, or
  8.     (at your option) any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #include "MemoryCalls.h"
  20. #include "Error.h"
  21.  
  22. /* Resource IDs of resources required for Error.c */
  23. #define kErrorStrings 200
  24. #define kInternalErrorStrings 600
  25. #define kErrorAlert 128
  26.  
  27. void ExitError(unsigned int err)
  28. {
  29.     Str255 str;
  30.     
  31.     /* Get enough free memory to display an alert */
  32.     MemoryCleanUp();
  33.     
  34.     /* Get string corresponding to current FATAL error condition */
  35.     GetIndString(str, kErrorStrings, err);
  36.  
  37.     /* Store that string in our dialog ParamText (^0) */
  38.     if (str[0]!=0) ParamText(str, "\p", "\p", "\p");
  39.     /* String not found, generic error condition */
  40.     else ParamText("\pUnknown error condition.  Program may be corrupted.", "\p", "\p", "\p");
  41.     
  42.     /* Display the alert. When user clicks OK exit */
  43.     StopAlert(kErrorAlert, nil);
  44.     ExitToShell();
  45. }
  46.  
  47. void InternalError(signed int err)
  48. {
  49.     Str255 str;
  50.     
  51.     /* Get string corresponding to current internal error condition */
  52.     GetIndString(str, kInternalErrorStrings, -err);
  53.  
  54.     /* Drop into MacsBug with error displayed */
  55.     DebugStr(str);
  56. }
  57.